set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode='nonstrict';
set hive.exec.max.dynamic.partitions=400;
set hive.exec.max.dynamic.partitions.pernode=400;


--------------汇总结果
insert overwrite table jms_dm.dm_false_send_xyf_summary_dt partition (dt)
select 
     start_network_code           as network_code          --网点编码
    ,start_network_name           as network_name          --网点名称
    ,start_agent_code             as agent_code            --代理区编码
    ,start_agent_name             as agent_name            --代理区名称
    ,start_virt_code              as virt_code             --虚拟代理区编码
    ,start_virt_name              as virt_name             --虚拟代理区名称
    ,count(1)                     as total_cnt             --揽收后超24小时量
    ,to_date(taking_time)         as taking_date           --揽收日期
    ,to_date(customer_order_time) as customer_order_date   --下单日期
    ,dt
from jms_dm.dm_false_send_xyf_detail_dt
where dt = date_sub('{{ execution_date | cst_ds }}',1)
group by start_network_code            --网点编码
        ,start_network_name            --网点名称
        ,start_agent_code              --代理区编码
        ,start_agent_name              --代理区名称
        ,start_virt_code               --虚拟代理区编码
        ,start_virt_name               --虚拟代理区名称
        ,to_date(taking_time)          --揽收日期
        ,to_date(customer_order_time)  --下单日期
        ,dt
distribute by dt;
